use single_thread_final::{route_request, RequestLine};

#[test]
fn route_request_returns_root_page() {
    let request = RequestLine {
        method: "GET".into(),
        path: "/".into(),
        version: "HTTP/1.1".into(),
    };

    let route = route_request(&request);

    assert_eq!(route.status_line, "HTTP/1.1 200 OK");
    assert_eq!(route.filename, "hello.html");
}

#[test]
fn route_request_returns_404_for_unknown_path() {
    let request = RequestLine {
        method: "GET".into(),
        path: "/unknown".into(),
        version: "HTTP/1.1".into(),
    };

    let route = route_request(&request);

    assert_eq!(route.status_line, "HTTP/1.1 404 NOT FOUND");
    assert_eq!(route.filename, "404.html");
}